﻿using LxCFD;
using Prism.Mvvm;

namespace TimeSolve
{
    public class MaterialDataVM : BindableBase
    {
        public MaterialDataVM(MaterialData materialData)
        {
            this.materialData = materialData;
        }
        public MaterialData materialData;
        public string name { get => materialData.Name; set { materialData.Name = value; RaisePropertyChanged("name"); } }


        public double density
        {
            get => materialData.ConstDensity.Number;
            set
            {
                materialData.ConstDensity.Number = value;
                RaisePropertyChanged("density");
            }
        }


        public double specificHeat
        {
            get
            {
                if (materialData.SpecificHeat is Value1Const.Double vc)
                {
                    return vc.Number;
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                materialData.SpecificHeat = new Value1Const.Double(value);
                RaisePropertyChanged("specificHeat");
            }
        }

        public double thermalConductivity
        {
            get
            {
                if (materialData.ThermalConductivity is Value1Const.Double vc)
                {
                    return vc.Number;
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                materialData.ThermalConductivity = new Value1Const.Double(value);
                RaisePropertyChanged("thermalConductivity");
            }
        }

        public double viscosity
        {
            get
            {
                if (materialData.Viscosity is Value1Const.Double vc)
                {
                    return vc.Number;
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                materialData.Viscosity = new Value1Const.Double(value);
                RaisePropertyChanged("viscosity");
            }
        }

        public double thermalExpansionCoefficent
        {
            get
            {
                return materialData.ThermalExpansionCoefficent;

            }
            set
            {
                materialData.ThermalExpansionCoefficent = value;
                RaisePropertyChanged("thermalExpansionCoefficent");
            }
        }

    }
}
